package unamed.Art;

import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;

public class Art{
    
    public static BufferedImage blaster;
    public static BufferedImage blaster_overlay;
    public static BufferedImage blast;
    
    public static void create(){
        try {
            blaster=ImageIO.read(Art.class.getResourceAsStream("Power/blaster.png"));
            blaster_overlay=ImageIO.read(Art.class.getResourceAsStream("Power/blaster_overlay.png"));
            blast=ImageIO.read(Art.class.getResourceAsStream("Blast.png"));
        } catch (IOException ex) {ex.printStackTrace();}
    }
    
    public static BufferedImage rotate(BufferedImage img,double angle){
        int w=img.getWidth();
        int h=img.getHeight();
        BufferedImage i=new BufferedImage(w*2,h*2,img.getType());
        Graphics2D g=i.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,RenderingHints.VALUE_COLOR_RENDER_QUALITY);
        g.rotate(angle,w,h);
        g.drawImage(img,null,w/2,h/2);
        g.dispose();
        return i;
    }
    
    public static BufferedImage rotate(BufferedImage img,double angle,int w,int h){
        int wi=img.getWidth();
        int hi=img.getHeight();
        BufferedImage i=new BufferedImage(w,h,img.getType());
        Graphics2D g=i.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,RenderingHints.VALUE_COLOR_RENDER_QUALITY);
        g.rotate(angle,w/2,h/2);
        g.drawImage(img,null,w/2-wi/2,h/2-hi/2);
        g.dispose();
        return i;
    }
    
    public static BufferedImage scale(BufferedImage img,int w,int h){
        BufferedImage i=new BufferedImage(w,h,img.getType());
        Graphics2D g=i.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);  
        g.drawImage(img,0,0,w,h,0,0,img.getWidth(),img.getHeight(),null);  
        g.dispose();
        return i;
    }
    
}